home *** CD-ROM | disk | FTP | other *** search
- Path: leopard.wmin.ac.uk!tqaec
- From: tqaec@westminster.ac.uk (Renato Araujo)
- Newsgroups: comp.lang.c++
- Subject: NEWBIE: Returning 0 as refernce
- Date: 10 Mar 1996 15:32:04 GMT
- Organization: University of Westminster
- Message-ID: <4huslk$rpk@badger.wmin.ac.uk>
- NNTP-Posting-Host: leopard.wmin.ac.uk
- X-Newsreader: TIN [version 1.2 PL2]
-
- I am trying to write bits of Linux in C++. In order to make it fast I try to
- return references instead of pointers (some classes are rather big). But what
- is the standard way of returning a reference when it is not found
- Let me try to explain for example: a method searchs for an object and
- returns if found, when it is not found I thought about returnig a 0, but I get
- compilation error ( as expected). My first idea was to overload operator= for 0
- so the returned object would be a dummy. But wouldn't it make the method
- slower? or is there a better way of doing this?
- Thanking you in advance.
- Renato Araujo
-
-